package com.item.service.impl;

import com.github.pagehelper.PageHelper;
import com.item.domain.VideoPay;
import com.item.mapper.VideoPayMapper;
import com.item.service.VideoPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VideoPayServiceImpl implements VideoPayService {

    @Autowired
    VideoPayMapper videoPayMapper;

    @Override
    public List<VideoPay> findAll(int limit, int page, VideoPay videoPay) {
        if (limit > 0 && page > 0) {
            PageHelper.startPage(limit, page);
        }
        return videoPayMapper.findAll(videoPay);
    }

    @Override
    public int add(VideoPay videoPay) {
        return videoPayMapper.insertSelective(videoPay);
    }

    @Override
    public int update(VideoPay videoPay) {
        return videoPayMapper.updateByPrimaryKeySelective(videoPay);
    }

    @Override
    public int delete(int id) {
        return videoPayMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<VideoPay> findAllTest() {
        return videoPayMapper.selectAll();
    }


}
